﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@

<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>

<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="//unpkg.com/layui@2.9.20/dist/css/layui.css" rel="stylesheet">
</head>
<body>
    <table class="layui-table" height: 315>
        <colgroup>
            <col width="150">
            <col width="150">
            <col width="150">
            <col width="150">
        </colgroup>
        <thead>
            <tr>
                <th>序号</th>
                <th>权限</th>
                <th>权限URL</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody id="thisTd">
        </tbody>
    </table>
    <script>
        $(function () {
            getPerList();
        })

        function getPerList() {
            $.ajax({
                url: '@ViewBag.Darius'+"/api/Users/PermissionSearch",
                type: "get",
                success: function (res) {
                    $(res.data).each(function () {
                        $("#thisTd").append(`<tr>
                                                         <td>${this.permissionsId}</td>
                                                         <td>${this.permissionsName}</td>
                                                         <td>${this.url}</td>
                                                         <td>
                                                             <button type="button" class="layui-btn layui-btn-primary" lay-on="test-page" onclick="Caoz(${this.permissionsId})">编辑</button>
                                                             <button type="button" class="layui-btn layui-btn-primary" lay-on="test-page" onclick="Caoz(${this.permissionsId})">删除</button>
                                                         </td>
                                                     </tr>`)
                    })
                }
            })
        }
    </script>
</body>
</html>
